package com.jiangore.client;

import com.alibaba.fastjson.JSONObject;
import com.jiangore.ws.IHelloWebService;
import org.apache.cxf.endpoint.Client;
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;

/**
 * @Todo
 * @Author jiangtao
 * @CreateBy 2020-03-14 10:46 PM
 * @UpdateBy jiangtao
 * @Version v1.0
 */
public class CXFClient2Test {

    public static void main(String[] args) throws Exception {

        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
        factory.setServiceClass(IHelloWebService.class);
        factory.setAddress("http://localhost:8080/ws/hello?wsdl");
        // 需要服务接口文件
        IHelloWebService client = (IHelloWebService) factory.create();
        String result = client.helloWebServices("world!");
        System.out.println(JSONObject.toJSONString(result));

    }
}
